import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.MenuBar;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import java.util.Observable;
import java.util.Observer;

import javax.swing.JFrame;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
/**
 * the gui frame
 */
/**
 * 
 * 
 * @author Ronny
 * 
 */

public class KomMap extends JFrame implements ComponentListener {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private static final int MINIMUM_WIDTH = 1000;
	private static int MINIMUM_HEIGHT = 700;
	private static final String APP_NAME = "KomMap";
	public KomMapPane komMapPane;
	public KomConfigPane komconfigpane;
	private KomMapMenubar komMapmenuBar;
	public GUIController guiController;

	public KomMap()  {

		try {
			this.createMap();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (Throwable e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}

	public void createMap() {
		// JFrame frame = new JFrame();
	  this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		try {
			UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (InstantiationException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (UnsupportedLookAndFeelException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		this.setTitle(APP_NAME);
		this.setSize(600, MINIMUM_HEIGHT);
		this.setMinimumSize(new Dimension(MINIMUM_WIDTH, MINIMUM_HEIGHT));
		this.setPreferredSize(new Dimension(MINIMUM_WIDTH, MINIMUM_HEIGHT));
		this.setMaximumSize(new Dimension(MINIMUM_WIDTH, MINIMUM_HEIGHT));
		
		
		/**
		 * 
		 this.add(this.komMapmenuBar, BorderLayout.PAGE_START);
		 */
		this.setLayout(new BorderLayout());
		this.komMapPane = new KomMapPane(this);
		this.komconfigpane = new KomConfigPane(this);
        
		this.guiController=new GUIController(this);
		
        this.add(this.komMapPane, BorderLayout.CENTER);
		this.setJMenuBar(new KomMapMenubar(this));
		this.add(this.komconfigpane, BorderLayout.EAST);
		// this.add(this.komMapmenuBar, BorderLayout.PAGE_START);
		
		this.setVisible(true);
	}


	public static void main(String[] args) throws ClassNotFoundException {

		KomMap kommap = new KomMap();
		
	}

	@Override
	public void componentResized(ComponentEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void componentMoved(ComponentEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void componentShown(ComponentEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void componentHidden(ComponentEvent e) {
		// TODO Auto-generated method stub
		
	}
}
